/**
 * Created by: Sam Olmsted
 * Last edit: 4-20-2012
 * 
 * Opens a file and reads it's contents in order to convert it to a list of 
 * of boards
 **/

#include "state.h"
#include "board.h"


/**
 * Used to tell if the operation worked or failed
 **/
typedef enum status{ //replaces enum value
  SUCCESS, 
  ERROR
};

/**
 * readFile container
 **/
typedef struct{
  char* string; 
  enum status status;
} fileStruct;

/**
 * parseString container
 **/
typedef struct{
  char** moves;
  int size;
  enum status status;
} parseStruct;

/**
 * makeGame container
 **/
typedef struct{
  Position* moves;
  enum status status;
} gameStruct;


/** 
 * Read the string from the given file. 
 * [  if filename can be opened -> 
 *        return *fileStruct, with the string of the file . 
 *    else -> 
 *        return a returnContainer, representing ERROR ]
 **/
fileStruct* readFile(char* filename); 

 /** 
  * Convert the given String into an array of moves. 
  * [  let struct be a parseStruct->
  *    if the file can be parsed ->
  *        struct->moves := a list of moves  
  *        struct->size  := number of moves
  *        struct->status  := SUCCESS 
  *    else -> 
  *        struct->status:= ERROR 
  *    in eather case
  *		   return struct ]
  **/
parseStruct* parseString(char* string); 

/**
 * Converts a array of moves into a list of positions.
 * [  let struct be a gameStruct->
  *    if the string array can be converted -> 
 *        struct->moves := a linked list of boards 
 *        struct->status := SUCCESS 
 *    else -> 
 *        struct->status := ERROR
  *    in eather case
  *		  return struct ]
 **/
gameStruct* makeGame(char** moves, int size);
